<?php

namespace controller;

class demo
{
    public function blade()
    {
        echo view_blade()->run('blade/index', ['title' => "blade演示页面",
            'neirong' => '从控制器demo@blade中来的内容',
            'html' => "<b>html内容测试</b>",
            'arr' => ['a', 'b', 'c']]);
    }

    public function twig()
    {
        echo view_twig()->render('twig/index.twig', ['title' => "twig演示页面",
            'neirong' => '从控制器demo@blade中来的内容',
            'html' => "<b>html内容测试</b>",
            'arr' => ['a', 'b', 'c'],
            'show' => getGet('show')
        ]);
    }

    public function plates()
    {
        echo view_plates()->render('plates/index.plates', ['title' => "plates演示页面",
            'neirong' => '从控制器demo@plates中来的内容',
            'html' => "<b>html内容测试</b>",
            'arr' => ['a', 'b', 'c'],
            'show' => getGet('show')
        ]);
    }

    public function mustache()
    {
        #传入匿名函数
        $f = ['getCss' => function ($text) {
            return getCss($text);
        }];
        echo view_mustache()->render('mustache/index', [
            'title' => "mustache演示页面",
            'neirong' => '从控制器demo@blade中来的内容',
            'html' => "<b>html内容测试</b>",
            'arr' => ['a', 'b', 'c'],
            'show' => getGet('show'), 'f' => $f,
            'css' => ['bootstrap.min']
        ]);
    }
}
